{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
  <div class="medium-9 columns">
    <div class="section">
    {% include "partials/discussion_list.html" %}
    </div>
  </div>
  <div class="medium-3 columns">
  {% if vnode['doc_type'] == vj4.model.document.TYPE_PROBLEM %}
    {% with pdoc=vnode, owner_udoc=udict[vnode['owner_uid']], owner_dudoc=dudict[vnode['owner_uid']] if dudict %}
    {% include "partials/problem_sidebar.html" %}
    {% endwith %}
  {% elif vnode['doc_type'] == vj4.model.document.TYPE_CONTEST %}
    {% with tdoc=vnode, owner_udoc=udict[vnode['owner_uid']], owner_dudoc=dudict[vnode['owner_uid']] if dudict %}
    {% include "partials/contest_sidebar.html" %}
    {% endwith %}
  {% elif vnode['doc_type'] == vj4.model.document.TYPE_DISCUSSION_NODE %}
    <div class="section side">
      {% if vnode['pic'] %}<div class="discussion-node__bg {{ vnode['pic'] }}"></div>{% endif %}
      <div class="section__header">
        <h1 class="section__title">{{ vnode['title'] or _('Create Discussion') }}</h1>
      </div>
      <div class="section__body">
      {% if vnode %}
      {% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
        <p><a href="{{ reverse_url('discussion_create', doc_id=vnode['doc_id']) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p>
      {% else %}
        {% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
          <p><a href="javascript:showSignInDialog();" class="expanded primary button">{{ _('Login to Create a Discussion') }}</a></p>
        {% else %}
          <p><a href="javascript:;" class="disabled expanded primary button">{{ _('No Permission to Create a Discussion') }}</a></p>
        {% endif %}
      {% endif %}
      {% else %}
        <p>{{ _('Select a node to create discussion.') }}</p>
      {% endif %}
      </div>
    </div>
  {% endif %}
    {% include 'discussion_nodes_widget.html' %}
  </div>
</div>
{% endblock %}
